package com.cbg.sys.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.cbg.base.core.SuperEntity;
import java.time.LocalDate;
import java.time.Period;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 排班表
 * </p>
 *
 * @author chenbing
 * @since 2018-12-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_line")
public class Line extends SuperEntity<Line> {

    private static final long serialVersionUID = 1L;

    /**
     * 发车时间区间头
     */
    private String goTimeHead;

    /**
     * 发车时间区间尾
     */
    private String goTimeTail;

    /**
     * 日期标识，0为今天1为明天2为后天，其他数字为以后某天
     */
    private Integer dateSign;

    /**
     * 日期
     */
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate dateIn;

    /**
     * 关联路线id
     */
    private String routeId;

    public Integer getDateSign() {
        return Period.between(LocalDate.now(),this.getDateIn()).getDays();
    }
}
